In this homework, we’ll be working on getting you set up with the tools you will need for this class. Once you are set up, we’ll do what we’re here to do: analyze data!
Here’s what we will accomplish by the end of the assignment:
We need two basic sets of tools for this class. We will need
R to analyze data. We will need RStudio to
help us interface with R and to produce documentation of our
results.
R is going to be the only programming language we will use. R is an extensible statistical programming environment that can handle all of the main tasks that we’ll need to cover this semester: getting data, analyzing data and communicating data analysis.
If you haven’t already, you need to download R here: https://cran.r-project.org/.
When we work with R, we communicate via the command line. To help automate this process, we can write scripts, which contain all of the commands to be executed. These scripts generate various kinds of output, like numbers on the screen, graphics or reports in common formats (pdf, word). Most programming languages have several I ntegrated D evelopment E nvironments (IDEs) that encompass all of these elements (scripts, command line interface, output). The primary IDE for R is RStudio.
If you haven’t already, you need to download RStudio here: https://rstudio.com/products/rstudio/download/. You need the free RStudio desktop version.
In each class, we’re going to include some code and text in one file,
and data in another file. You’ll need to download both of these files to
your computer. You need to have a particular place to put these files.
Computers are organized using named directories (sometimes called
folders). Don’t just put the files in your Downloads directory. One
common solution is to created a directory on your computer named after
the class: psc_4175. Each time you access the files, you’ll
want to place them in that directory.
We’re going to grab some data that’s part of the college scorecard and do a bit of analysis on it.
Open RStudio, then create a new .Rmd file.
To do this, click on File → New File →
R Markdown....
You will then be asked to determine a bunch of settings for this
.Rmd document. For example, you can choose whether you want
to create a “Document”, “Presentation”, “Shiny”, or “From Template” on
the left. You can set the “Title:” “Author:” and “Date:” on the
top-right. And you can choose the “Default Output Format:” to be either
“HTML”, “PDF”, or “Word”. You should not change any of these
settings. Their defaults (“Document”, “Untitled”, “[Your
name]”, “[Today’s Date]”, and “HTML”) are sufficient. Just click
“OK”.
Copy the raw code from the psc4175_hw_1.Rmd
file by clicking on the copy button as shown in the image below.
Finally, replace the default code in your R Markdown file with the copied code from the GitHub!
If viewing this as an html file, you can view this gif for more help!